/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Tipo_Infraccion")
@NamedQueries({
    @NamedQuery(name = "TipoInfraccion.findAll", query = "SELECT t FROM TipoInfraccion t"),
    @NamedQuery(name = "TipoInfraccion.findByIdTipoInfraccion", query = "SELECT t FROM TipoInfraccion t WHERE t.idTipoInfraccion = :idTipoInfraccion"),
    @NamedQuery(name = "TipoInfraccion.findByNombre", query = "SELECT t FROM TipoInfraccion t WHERE t.nombre = :nombre"),
    @NamedQuery(name = "TipoInfraccion.findByDescripcion", query = "SELECT t FROM TipoInfraccion t WHERE t.descripcion = :descripcion"),
    @NamedQuery(name = "TipoInfraccion.findByDiasInf", query = "SELECT t FROM TipoInfraccion t WHERE t.diasInf = :diasInf"),
    @NamedQuery(name = "TipoInfraccion.findByEstado", query = "SELECT t FROM TipoInfraccion t WHERE t.estado = :estado")})
public class TipoInfraccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdTipoInfraccion")
    private Integer idTipoInfraccion;
    @Size(max = 30)
    @Column(name = "Nombre")
    private String nombre;
    @Size(max = 100)
    @Column(name = "Descripcion")
    private String descripcion;
    @Column(name = "DiasInf")
    private Integer diasInf;
    @Column(name = "Estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idTipoInfraccion", fetch = FetchType.LAZY)
    private List<Infraccion> infraccionList;

    public TipoInfraccion() {
    }

    public TipoInfraccion(Integer idTipoInfraccion) {
        this.idTipoInfraccion = idTipoInfraccion;
    }

    public Integer getIdTipoInfraccion() {
        return idTipoInfraccion;
    }

    public void setIdTipoInfraccion(Integer idTipoInfraccion) {
        this.idTipoInfraccion = idTipoInfraccion;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public Integer getDiasInf() {
        return diasInf;
    }

    public void setDiasInf(Integer diasInf) {
        this.diasInf = diasInf;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public List<Infraccion> getInfraccionList() {
        return infraccionList;
    }

    public void setInfraccionList(List<Infraccion> infraccionList) {
        this.infraccionList = infraccionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoInfraccion != null ? idTipoInfraccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoInfraccion)) {
            return false;
        }
        TipoInfraccion other = (TipoInfraccion) object;
        if ((this.idTipoInfraccion == null && other.idTipoInfraccion != null) || (this.idTipoInfraccion != null && !this.idTipoInfraccion.equals(other.idTipoInfraccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.TipoInfraccion[ idTipoInfraccion=" + idTipoInfraccion + " ]";
    }
    
}
